/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package verificador.proposiciones;

/**
 *
 * @author 1
 */
import java.io.*;
import java.util.*;
public class FileManager {
    
    public String[] readFile(File file){
        BufferedReader br = null;
        List<String> readLines = new ArrayList();
        try {
            br = new BufferedReader(new FileReader(file));
            String line = br.readLine();
            while (line != null) {
                readLines.add(line);
                line = br.readLine();
            }
        } catch( FileNotFoundException e){
            System.out.println(e.getLocalizedMessage());
        } catch( Exception e){
            e.printStackTrace();
        }
        finally {
            if(br != null) {
                closeFile(br);
            }
        }
        return readLines.toArray( new String[readLines.size()]);
    }
    public static void closeFile(Closeable c) {
        try{
            if(c != null) {
                c.close();
            }
        } catch(Exception e){
            e.printStackTrace();
        }
    }
}
